﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BillardPHS4700 {
    class Utils {
        public static T ParseEnum<T>(string value) {
            return (T)Enum.Parse(typeof(T), value);
        }

        public static T Clamp<T>(T val, T min, T max) where T : IComparable<T> {
            if (val.CompareTo(min) < 0) return min;
            if (val.CompareTo(max) > 0) return max;
            return val;
        }
    }
}
